/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc.demo;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;
import java.util.List;

/**
 * <p>Project: MybatisPro - hello</p>
 * <p>Powered by yzc On 2023-10-07 10:22:01</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
public class hello {
    public static void main(String[] args) {
     try(InputStream is = Resources.getResourceAsStream("mybatis-config.xml")) {
         SqlSessionFactory sf = new SqlSessionFactoryBuilder().build(is);
         SqlSession ss = sf.openSession();
         String ver = ss.selectOne("version");
         System.out.println(ver);
         List<String> dbs = ss.selectList("dbs");
         System.out.println(dbs);
     }catch (Exception e){
        e.printStackTrace();
     }
    }
}
